package com.china08.yxyapi.repository.db.lesson;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;

import com.china08.yxyapi.entity.db.lessons.cloud.YxyLessonsCloudLessonItem;

public interface YxyLessonsCloudLessonItemRepository extends JpaRepository<YxyLessonsCloudLessonItem, String> {

    YxyLessonsCloudLessonItem findById(String id);

    List<YxyLessonsCloudLessonItem> findByLessonIdAndStatusNotOrderByOrderNumAsc(String lessonId, Integer status);

    List<YxyLessonsCloudLessonItem> findByLessonIdAndStatus(String lessonId, Integer status);

    List<YxyLessonsCloudLessonItem> findByLessonIdAndStatusNot(String lessonId, Integer status);

    List<YxyLessonsCloudLessonItem> findByLessonId(String lessonId);

    Integer countByLessonId(String lessonId);

    Integer countByLessonIdAndStatus(String lessonId, Integer status);

    Integer countByLessonIdAndStatusNot(String lessonId, Integer status);

    YxyLessonsCloudLessonItem findTop1ByLessonIdOrderByOrderNumDesc(String lessonId);

    List<YxyLessonsCloudLessonItem> findByLessonIdAndStatusOrderByOrderNum(String lessonId, int i);

    YxyLessonsCloudLessonItem findTop1ByLessonIdAndStatusNotAndOrderNumLessThanOrderByOrderNumDesc(String lessonId,
            Integer status, Integer orderNum);

    YxyLessonsCloudLessonItem findTop1ByLessonIdAndStatusNotAndOrderNumGreaterThanOrderByOrderNumAsc(String lessonId,
            Integer status, Integer orderNum);
}
